package creditnum;

public class CreditData {
	public static final int MAX_NUMBERS = 5;
	private String[] cardNumber;
	private int nextEmpty = -1;

	CreditData() {
		this.cardNumber = new String[MAX_NUMBERS];
	}

	// getters and setters
	public void setCardNumber(String cardNumber) {
		if (cardNumber != null && cardNumber != "") {
			nextEmpty++;
			this.cardNumber[nextEmpty] = cardNumber;
		}
	}

	public String getCardNumber(int cardPosition) {
		if (cardPosition > 0 && cardPosition < this.cardNumber.length) {
			return this.cardNumber[cardPosition];
		} else {
			return "";
		}
	}
	public int getLength(){
		return MAX_NUMBERS;
	}

}
